<#include "../layout/layout.ftl"/>
<@body>
 <script src="/script/tool/dubbo.js"></script>
<form method="post" action="/interface/saveInterface" class="form-horizontal">
    <div class="form-group">
        <label class="col-md-2">zookeeper地址:</label>
        <div class="col-md-5">
            <input name="header" id="zkAddress" type="text" class="form-control" value ="${protocol.header}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2">组件别名:</label>
        <div class="col-md-5">
            <input name="interfaceAliasName" type="text" class="form-control"
                 <#if protocol??> value="${protocol.interfaceAliasName!}"</#if>  />
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2">接口名称:</label>
        <div class="col-md-5">
            <select class="form-control" id="interfaceName" name="interfaceName">
                <#if interfaceList??>
                    <#list interfaceList as interfaceName>
                        <#if protocol?? && protocol.interfaceName??>
                            <#if interfaceName ==protocol.interfaceName>
                                 <option value="${protocol.interfaceName}" selected>${protocol.interfaceName}</option>
                            <#else >
                            <option value="${interfaceName}">${interfaceName}</option>
                            </#if>
                        <#else >
                           <option value="${interfaceName}">${interfaceName}</option>
                        </#if>
                    </#list>
                </#if>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2">IP端口号:</label>
        <div class="col-md-5">
            <select class="form-control" name="host" id="ip">
                <#if protocol?? && protocol.host??>
                    <option value="${protocol.host}" selected>${protocol.host}</option>
                </#if>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2">方法名称:</label>
        <div class="col-md-5">
            <select class="form-control" name="interfaceMethod" id="interfaceMethod" onchange="switchParamTemplate()">
                 <#if protocol?? && protocol.interfaceMethod??>
                     <option value="${protocol.interfaceMethod}" selected>${protocol.interfaceMethod}</option>
                 </#if>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-1">编码:</label>
        <div class="col-md-1">
            <select class="form-control" name="encoding" id="encoding">
                <option value="UTF-8">UTF-8</option>
                <option value="GBK">GBK</option>
            </select>
        </div>
        <label class="col-md-1">超时(秒):</label>
        <div class="col-md-1">
            <select class="form-control" name="timeout" id="timeout">
                <option value="5000">5</option>
                <option value="6000">6</option>
                <option value="7000">7</option>
                <option value="8000">8</option>
                <option value="9000">9</option>
                <option value="10000">10</option>
            </select>
        </div>
        <div class="col-md-5">
            <input type="hidden" name="interfaceType" value="dubbo"/>
            <input type="hidden" name="param" id="param">
            <input type="hidden" name="id" value="<#if protocol??>${protocol.id!}</#if>">
            <input type="button" class="btn btn-primary" onclick="resolveIP()" value="解析IP"/>
            <input type="button" class="btn btn-primary" onclick="resolveMethodForInterfaceManager()" value="解析方法"/>
            <input type="submit" value="保存" class="btn btn-primary">
        </div>
    </div>
    <div class="form-group">
        <span class="col-md-5" style="color: red;text-align: center;font-size: 30px">
            ${errorMsg!}
        </span>
    </div>
</form>

</@body>